import { find } from 'lodash'


const users = [
  { userId: 'admin', password: 'admin', uuid: 'admin-uuid', userName: '系统管理员', token: '792D564764214034B1EF64E681A5783A' },
  { userId: 'editor', password: 'editor', uuid: 'editor-uuid', userName: '编辑者', token: '792D564764214034B1EF64E681A5783B' },
  { userId: 'user1', password: 'user1', uuid: 'user1-uuid', userName: '普通用户1', token: '792D564764214034B1EF64E681A5783C' }
]

export default ({ service, request, tools }) => ({
  SYS: {
    //data ={userId:'',password:''}
    //用户登录
    async SYS_USER_LOGIN(data) {
      // return request('bwch.WebAPITest.QueryDepart', {});
      const user = find(users, data)
      return user
    },
    //修改密码 data={userId,oldPwd,newPwd}
    async AUTH_CHANGE_PWD(data) {
      return { isOk: true, errMsg: '旧密码验证失败' }
    }
  }
});